package com.mobile.challenge.ui.report.unit.admin;

import com.mobile.challenge.bean.AdminWeekMonthDataBean;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author Touge
 * @Date 2020/9/17 21:55
 * @Description
 */
public class AdminUtils {
    private static final AdminUtils ourInstance = new AdminUtils();

    private List<AdminWeekMonthDataBean> mList = new ArrayList<>();


    private AdminUtils() {
    }

    public static AdminUtils getInstance() {
        return ourInstance;
    }

    public void setList(List<AdminWeekMonthDataBean> list) {
        mList = list;
    }


    public AdminWeekMonthDataBean getAdminWeekMonthDataBean(String unitName) {
        for (AdminWeekMonthDataBean adminWeekMonthDataBean : mList) {
            if (adminWeekMonthDataBean.getUnitName().equalsIgnoreCase(unitName)) {
                return adminWeekMonthDataBean;
            }
        }
        return null;
    }

    public String getDateStr(int position) {
        if (position > mList.get(0).getTrackingList().size() - 1 || position <= 0) {
            return "";
        }
        return mList.get(0).getTrackingList().get(position).getDate();
    }
}
